<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <base href="<%=basePath%>">
    <title>查询作业</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
   	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/f/navs.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/f/default.css">
    <link href="css/f/stuviewa.css" rel="stylesheet" type="text/css">
	<script src="js/jquery.min.js"></script>
	<script src="js/f/default.js"></script>
  </head>
  
	<!--查询作业/提交-->
  <body>
  	<div class="all">
		<jsp:include page="/nav.jsp"></jsp:include>
       	<div class="rightall float-left">
            <div class="already">
                <div class="already-title">
					<div class="left">查询作业/提交</div>
				</div>
                <div class="content">
                	<input type="hidden" value="${error_msg }" name="errorMsg" />
                	<form method="post" action="student/assign.do">
                        <div style="margin-top: 15px;">
                            <span style=" margin-left:40%;"></span>
                            <input  class="task" placeholder="老师/科目" name="content" type="text">
                            <span style=" margin-left:50px;"></span>
                            <button class="task btn-style" style="width:5%" type="submit">查找</button>
                        </div>
                   	</form>
                       <table class="table"  cellpadding="0" cellspacing="0" id="aa">
		                	<tr class="tr-style-head">
		                    	<td>作业发布老师</td>
		                    	<td>作业科目</td>
		                    	<td>作业布置时间</td>
		                    	<td>截至提交时间</td>
		                    	<td>作业状态</td>
		                    	<td>提交状态</td>
		                    	<td>操作</td>
		                    </tr>
		                    <c:forEach var="s" items="${hws }">
			                	<tr class="tr-style">
			                    	<td>${s.tchName }</td>
			                    	<td>${s.courseName }</td>
			                    	<td>${s.createTime }</td>
			                    	<td>${s.homeworkDeadline }</td>
			                    	<td>
			                    		<c:if test="${s.submitState == 1 }">提交中</c:if>
			                    		<c:if test="${s.submitState == 2 }"><span style="color:red;">禁止</span></c:if>
			                    	</td>
			                    	<td>
			                    		<c:if test="${s.fulfilState == 1 }"><span style="color:red;">未提交</span></c:if>
			                    		<c:if test="${s.fulfilState == 2 }">已提交</c:if>
			                    	</td>
			                    	<td>
			                    		<input type="hidden" value="${s.homeworkContent}" name="tchContent" />
			                    		<input type="hidden" name="sendHmwId" value="${s.homeworkId }" />
			                    		<input type="hidden" name="sendFilePath" value="${s.homeworkFile }" />
			                        	<a href="javascript:void(0)" class="a-color-red" onclick="openById('#work_content');sendValue(this,'[name=\'tchContent\']','[name=\'tchWorkContent\']');sendValueToAttr(this,'[name=\'sendFilePath\']','[name=\'getFilePath\']','href')" >查看内容</a>
			                        	<c:if test="${s.fulfilState == 1 }">
			                        		<a href="javascript:void(0)" class="a-color-red" onclick="openById('#work_submit');sendValue(this,'[name=\'sendHmwId\']','[name=\'homewordId\']')" >提交作业</a>
			                        	</c:if>
			                        	<c:if test="${s.fulfilState == 2 }">
			                        		<a style="color:grey" onclick="return false;" >提交作业</a>
			                        	</c:if>
			                        </td>
			                    </tr>
		                    </c:forEach>
                	</table>
                	<c:if test="${pages > 1 }">
	               		<div class="previous">
		               		<c:if test="${pageNo>1}">
		                    	<a href="student/assign.do?pageNo=${pageNo-1 }">上一页</a>
		                	</c:if>
		                   	<c:forEach var="p" begin="1" end="${pages }" step="1">
		                   		<c:if test="${p==pageNo }">
		                   			<span style="font-size:18px;color:#446ee6;">&nbsp;${p}&nbsp;</span>
		                   		</c:if>
		                   		<c:if test="${p!=pageNo }">
		                   			<a href="student/assign.do?pageNo=${p }" >&nbsp;${p}&nbsp;</a>
		                   		</c:if>
		                   	</c:forEach>
		                    <c:if test="${pageNo<pages}">
		                    	<a href="student/assign.do?pageNo=${pageNo+1 }">下一页</a>
		                	</c:if>
	                   </div>
               	 	</c:if>
               </div>
           	</div>
        </div>
        <div class="float-clear"></div>
        <div class="work-position" id="work_submit">
        	<div class="work-position-content">
            	<div>
                	<a href="javascript:void(0)" class="float-right close" onClick="closeById('#work_submit');clearValue('[name=\'getHmwId\']')">
                		<img alt="关闭" title="关闭" src="image/f/close.jpg">
                	</a>
                    <br class="float-clear">
                </div>
            	<form class="work-form" action="student/submitWork.do" method="post" enctype="multipart/form-data">
               		<div>
                    	<textarea class="work-textarea" name="workContent" placeholder="填写备注或内容" ></textarea>
                    </div>
                    <div style="width:600px">
                    	<div style="margin:0 auto;" >
                            <input type="hidden" name="homewordId" value="" />
                            <input type="text" class="" id="fileup" readonly/>
                            <label class="btn-style form-upload" style="height:30px;line-height:28px;">选择文件
                            	<input type="file" class="xfile" name="uploadFile" value="" onchange="document.getElementById('fileup').value=this.value"/>
                            </label>
                    		<input  type="submit" onclick="return aler('请确认是否提交作业');"style="height:32px; margin-left:6px;line-height:26px;" class="btn-style form-upload" value="提交作业">
                    	</div>
                    </div>
                    <div class="float-clear"></div>
                </form>
            </div>
        </div>
        <div class="work-position" id="work_content">
        	<div class="work-position-content">
            	<div>
                	<a href="javascript:void(0)" class="float-right close" onClick="closeById('#work_content');clearValue('[name=\'tchWorkContent\']');clearValueToAttr('[name=\'getFilePath\']','href')">
                		<img alt="" src="image/f/close.jpg">
                	</a>
                    <br class="float-clear">
                </div>
                <h2 align="center">作业名称</h2>
                <div align="center">
                	<textarea class="work-textarea" name="tchWorkContent" readonly ></textarea>
                </div>
                <div align="center">
                    <a href="" name="getFilePath"><input  type="button" style="height:42px; margin-top:20px" class="btn-style form-upload" value="下载作业附件"></a>
                </div>
       		</div>
    	</div>
    </div>
   </body>
</html>
